/**
 * CCUT 2008
 */
package edu.ccut.saturn.studio.logic.policy;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gef.editpolicies.ResizableEditPolicy;
import org.eclipse.gef.handles.AbstractHandle;
import org.eclipse.swt.graphics.Color;

import edu.ccut.saturn.studio.logic.model.Shape;
import edu.ccut.saturn.studio.logic.model.ShapesDiagram;
import edu.ccut.saturn.studio.logic.parts.DiagramEditPart;

/**
 * ResizaEdidPolicyNoHandle是一个没有handle的图形。
 * 
 * @author alf
 */
public class ResizaEdidPolicyNoHandle extends ResizableEditPolicy {
	// private EditPart host;
	// private Shape shape;

	public ResizaEdidPolicyNoHandle() {
		// this.host = host;
	}

//	@Override
//	/**
//	 * 控制反馈的大小。
//	 */
//	protected Rectangle getInitialFeedbackBounds() {
//		// return super.getInitialFeedbackBounds();
//		Rectangle r = Rectangle.SINGLETON;
//		r.setBounds(new Rectangle(super.getInitialFeedbackBounds().x
//				+ super.getInitialFeedbackBounds().width / 2 - 25, super
//				.getInitialFeedbackBounds().y, 50, 50));
//
//		return r;
//	}

	@SuppressWarnings("unchecked")
	protected List createSelectionHandles() {
		List list = new ArrayList();
		CustomResizableHandleKit
				.addHandles((GraphicalEditPart) getHost(), list);
		changGColor(list);
		return list;
	}

	void changGColor(List<?> list) {
		AbstractHandle ff;
		for (int i = 0; i < list.size(); i++) {
			ff = (AbstractHandle) list.get(i);
			ff.setBackgroundColor(new Color(null, 115, 115, 115));
			ff.setForegroundColor(new Color(null, 115, 115, 115));
		}
	}

}
